package config


import (
	k8sclient "k8s_gui_client/k8s/client"
)

//configmap list
func GetConfigmaps(namespace string  ) (map[string]interface{},error){

	if namespace != "" {
	   return  k8sclient.CurrentK8sApiClient.GetAPI("/api/v1/namespaces/"+namespace+"/configmaps")
	} else {
	   return  k8sclient.CurrentK8sApiClient.GetAPI("/api/v1/configmaps")
		
	}
	
	
}

func ConfigmapURL(namespace string,name string) string {
	return "/api/v1/namespaces/" + namespace + "/configmaps/"+name
}

func GetConfigmapYaml(namespace string,name string) (string ,error){
    return k8sclient.CurrentK8sApiClient.GetAPIAsYaml(ConfigmapURL(namespace,name))
}